
 
		 **************************************************************
		 **															 **
		 ** Paper: Freedom of Foreign Movement and Human Trafficking **
		 **														     **
		 ** Authors: Sam R. Bell & Richard W. Frank 				 **
		 **															 **
		 ** Date: May 11, 2021										 **
		 **															 **
		 ** Task: Figure 2-CIRI freedom of movement over time		 **
		 **															 **
		 **************************************************************
 
										 
		clear
		version 16.1
		set seed 1234

	 	** change working directory
		cd "~"
	 
		use "CIRI 2011.dta", clear
 
		replace formov=. if formov==-999
		replace formov=. if formov==-77
		replace formov=. if formov==-66		
		
		sort year
		by year: sum formov if formov~=.
		
	 **DICHOTOMIZING **
	 
		gen f2di=.
		replace f2di=1 if formov==2
		label var f2di "FORMOV 2 (dich)"

		gen f1di=.
		replace f1di=1 if formov==1
		label var f1di "FORMOV 1 (dich)"

		gen f0di=.
		replace f0di=1 if formov==0
		label var f0di "FORMOV 0 (dich)"


	**TOTAL IN A YEAR **
	
		sort year
		by year: egen f2tot=count(f2di)
		by year: egen f1tot=count(f1di)
		by year: egen f0tot=count(f0di)
						 
		gen totcount=.
		replace totcount=156 if year==1981		  
		replace totcount=156 if year==1982		  
		replace totcount=160 if year==1983	
		replace totcount=161 if year==1984		  
		replace totcount=162 if year==1985		  
		replace totcount=165 if year==1986		  
		replace totcount=166 if year==1987		  
		replace totcount=167 if year==1988		  
		replace totcount=167 if year==1989		  
		replace totcount=165 if year==1990
		replace totcount=166 if year==1991		  
		replace totcount=179 if year==1992		  
		replace totcount=183 if year==1993	
		replace totcount=183 if year==1994		  
		replace totcount=184 if year==1995		  
		replace totcount=187 if year==1996		  
		replace totcount=186 if year==1997		  
		replace totcount=184 if year==1998		  
		replace totcount=186 if year==1999		    
		replace totcount=187 if year==2000	  
		replace totcount=191 if year==2001
		replace totcount=192 if year==2002
		replace totcount=191 if year==2003
		replace totcount=191 if year==2004
		replace totcount=191 if year==2005
		replace totcount=191 if year==2006 
		replace totcount=191 if year==2007
		replace totcount=191 if year==2008
		replace totcount=191 if year==2009	  
		replace totcount=191 if year==2010
		replace totcount=192 if year==2011
	 
  
	**PERCENTAGE **

		gen f2pct=f2tot/totcount
		label var f2pct "No restrictions"
		gen f1pct=f1tot/totcount
		label var f1pct "Somewhat restricted"
		gen f0pct=f0tot/totcount
		label var f0pct "Severely restricted"

		twoway (line f2pct year, sort) (line f1pct year, sort)(line f0pct year, sort)  , /// 
		 ytitle(% of countries in sample) legend(pos(6) cols(3)) xtitle("") xlabel(1981(2)2011)
		graph save ffm_over_time.gph, replace
		
		
 
